.TH std::error_code::operator= 3 "2024.06.10" "http://cppreference.com" "C++ Standard Libary"
.SH NAME
std::error_code::operator= \- std::error_code::operator=

.SH Synopsis
   template< class ErrorCodeEnum >                            \fB(1)\fP \fI(since C++11)\fP
   error_code& operator=( ErrorCodeEnum e ) noexcept;
   error_code& operator=( const error_code& other ) =         \fB(2)\fP \fI(since C++11)\fP
   default;                                                       (implicitly declared)
   error_code& operator=( error_code&& other ) = default;     \fB(3)\fP \fI(since C++11)\fP
                                                                  (implicitly declared)

   1) Replaces the error code and corresponding category with those representing error
   code enum e.

   Equivalent to *this = make_error_code(e), where make_error_code is only found by
   argument-dependent lookup.

   This overload participates in overload resolution only if
   std::is_error_code_enum<ErrorCodeEnum>::value is true.
   2,3) Implicitly defined copy-assignment operator and move-assignment operator assign
   the contents of other to *this.

.SH Parameters

   e     - error code enum to construct
   other - another error code to assign with

.SH Return value

   *this

   Defect reports

   The following behavior-changing defect reports were applied retroactively to
   previously published C++ standards.

      DR    Applied to          Behavior as published              Correct behavior
   LWG 3629 C++11      only std::make_error_code overloads were ADL-found overloads are
                       used                                     used

.SH See also

   assign assigns another error code
          \fI(public member function)\fP
